home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
gamesrc
/
fring11
/
map_mak2.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-12-17
|
5KB
|
170 lines
{
***************************************************************************
* MAP_MAKER2 - for (2/12/92) *
* FRINGDUS - The Game. *
* *
* By Jason Nunn (JsNO BAR----NUNN) *
* *
* Email: nunn@pandanus.cs.ntu.edu.au *
* *
* Description: allows you to change byte (sprite) values of the map file *
* matrix. *
* *
***************************************************************************
}
program map_maker2;
uses crt;
const
nullchar = #0;
enter = #13;
back_space = #8;
bell = #7;
uparrow = #0#72;
leftarrow = #0#75;
rightarrow = #0#77;
downarrow = #0#80;
esc = #27;
space = ' ';
page_up = #0'I';
page_down = #0'Q';
home = #0'G';
eend = #0'O';
type
map_attrib = record
bloc : array[0..99,0..99] of byte;
end;
map_file_attrib = file of map_attrib;
var
map_file : map_file_attrib;
map : map_attrib;
cy : byte;
cx : byte;
ccy : integer;
ccx : integer;
hcy : integer;
hcx : integer;
ch : string[2];
{
***************************************************************************
* *
* No Documentation - Code is obvious *
* *
***************************************************************************
}
procedure enter_cell;
var
inch : string[20];
old_inch : string[20];
errpos : integer;
begin
old_inch := '';
ch := #0;
ccx := 0;
ccy := 0;
hcx := 0;
hcy := 0;
repeat
clrscr;
for cy := 0 to 20 do
for cx := 0 to 20 do
begin
gotoxy((1 + cx) * 3, cy + 1);
if (hcx = cx) and (hcy = cy) then
begin
textbackground(1);
textcolor(15);
write(map.bloc[cx + ccx, cy + ccy]);
end
else
begin
textbackground(0);
textcolor(7);
write(map.bloc[cx + ccx, cy + ccy]);
end;
end;
gotoxy(1,23);
textbackground(0);
textcolor(5);
write('Block: ', map.bloc[hcx + ccx, hcy + ccy]);
ch := readkey;
if ch = #0 then ch := ch + readkey;
if ch = enter then
begin
gotoxy(1,23);
textcolor(5);
write('Enter new Value: ');
readln(inch);
if inch = '' then inch := old_inch; {If you want to repeat a value,}
{Then just press return without}
{entering nothing}
val(inch, map.bloc[hcx + ccx, hcy + ccy],errpos);
old_inch := inch;
end;
if ch = uparrow then ccy := ccy - 1;
if ch = downarrow then ccy := ccy + 1;
if ch = leftarrow then ccx := ccx - 1;
if ch = rightarrow then ccx := ccx + 1;
if ch = #0 then ch := ch + readkey;
if ch = 'i' then hcy := hcy - 1;
if ch = 'm' then hcy := hcy + 1;
if ch = 'j' then hcx := hcx - 1;
if ch = 'k' then hcx := hcx + 1;
if ccy < 0 then ccy := 0;
if ccx < 0 then ccx := 0;
if ccy > (99 - 20) then ccy := (99 - 20);
if ccx > (99 - 20) then ccx := (99 - 20);
if hcy < 0 then hcy := 0;
if hcx < 0 then hcx := 0;
if hcy > 20 then hcy := 20;
if hcx > 20 then hcx := 20;
until ch = 's';
end;
{
***************************************************************************
* *
* No Documentation - Code is obvious *
* *
***************************************************************************
}
begin
if paramstr(1) = '-h' then
begin
writeln; {logo.......hey ya!, hey ya!, hey ya!}
writeln('MAP_MAK2 - By Jason Nunn - (C) 1992 - This Game is Freeware');
writeln;
writeln('Instructions: Read Manual (readme.txt)');
writeln;
end
else
begin
assign(map_file, 'fring1.map');
{$I-}
reset(map_file);
{$I-}
if ioresult = 0 then
begin
read(map_file, map);
end;
enter_cell;
seek(map_file, 0);
rewrite(map_file);
write(map_file,map);
close(map_file);
end;
textcolor(7);
end.